var ClubWanFaDetailsWindow = Window.extend({
    _ccsFileName: res.ClubWanFaDetailsWindow_json,
    _clubId: null,
    _selectFloor: null,
    initWindow: function (clubId, floor) {
        this._clubId = clubId;
        this._selectFloor = floor;

        var wanfas = ClubDataManager.getClubWanfas(this._clubId);
        var wanfaInfo = _.filter(wanfas, function (obj) {
            return obj.pos == floor;
        });
        var wanfaInfoDesc = this._handleWanfaDesp(wanfaInfo[0]['desc']);
        if (wanfaInfo && wanfaInfo.length) {
            var wanfastr = "玩法：\n" + wanfaInfoDesc;
            this._nodeList['lb_content'].setString(wanfastr);
            this._nodeList['btn_setwf'].setVisible(ClubDataManager.isSelfAdministration(this._clubId, gameData.uid));
        } else {
            this._nodeList['lb_content'].setString(decodeURIComponent('还没有设置玩法'));
            this._nodeList['btn_setwf'].setVisible(false);
        }
        if (ClubDataManager.getClubTableWindowState()) {
            this._nodeList['btn_setwf'].setVisible(false);
        }

        if (this._selectFloor == 0) {
            this._nodeList['btn_setwf'].setVisible(false);
            this._nodeList['lb_content'].setString(decodeURIComponent('混合玩法开启状态支持玩家自由创建玩法'));
        }
    },

    _initClickListeners: function () {
        this._clickListeners = {
            'btn_setwf': '_changeWanfa',
        };
    },
    _changeWanfa: function () {
        this.close();
        club.openCreateRoomWindow(this._clubId, this._selectFloor, true, true);
        // showWindow('CreateRoomWindow', 'hall', true, this._clubId, true, this._selectFloor);
    },
    _handleWanfaDesp: function (wanfaDesp){
        var removedStrArr =['2人PK', '3人激情', '2人玩', '3人玩', '4人玩',
            '局数: 6局', '局数: 8局', '局数: 10局', '群主支付', '房主支付', 'AA支付'];
        var retVal = wanfaDesp;
        var retValArr = retVal.split(',');
        var locationArr = [];
        for (var i = 0; i < retValArr.length; i++){
            retValArr[i] = retValArr[i].trim();
            if (removedStrArr.indexOf(retValArr[i]) > -1) locationArr.push(i);
        }

        for (var i = locationArr.length - 1; i > -1; i--){
            retValArr.splice(locationArr[i], 1);
        }

        retVal = retValArr.join(',');

        return retVal;
    },

});